/* GUI CONVERTED from reoprp38.p (converter v1.76) Tue Jul 23 22:42:56 2002 */
/* reoprp38.p - REPETITIVE OPERATIONS BY EMPLOYEE REPORT                      */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.5.1.7 $                                                       */
/*V8:ConvertMode=FullGUIReport                                                */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*                */
/* REVISION: 7.3      LAST MODIFIED: 01/05/95   BY: cpp *FT95*                */
/* REVISION: 7.3      LAST MODIFIED: 03/01/95   BY: WUG *G0G3*                */
/* REVISION: 7.3    LAST MODIFIED: 07/02/96 BY: *G1Z2* Julie Milligan         */
/* REVISION: 8.6      LAST MODIFIED: 10/10/97   BY: bvm *K0R6*                */

/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 05/05/00   BY: *N09M* Inna Lyubarsky     */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.5.1.5     BY: Hualin Zhong      DATE: 05/30/01  ECO: *N0YY*    */
/* Revision: 1.5.1.6   BY: Manisha Sawant    DATE: 08/20/01  ECO: *P01N*    */
/* $Revision: 1.5.1.7 $     BY: Subramanian Iyer    DATE: 07/15/02   ECO: *N1P5*      */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}


/* CHANGE VARIABLES TO HAVE no-undo STATUS. */
define variable wkctr                like op_wkctr    no-undo.
define variable wkctr1               like op_wkctr    no-undo.
define variable mch                  like op_mch      no-undo.
define variable mch1                 like op_mch      no-undo.
define variable emp                  like op_emp      no-undo.
define variable emp1                 like op_emp      no-undo.
define variable part                 like op_part     no-undo.
define variable part1                like op_part     no-undo.
define variable opdate               like op_date     no-undo.
define variable opdate1              like op_date     no-undo.
define variable shift                like op_shift    no-undo.
define variable op_qty_scrap         like op_qty_comp no-undo.
define variable op_qty_move          like op_qty_comp no-undo.
define variable include_nonmilestone like mfc_logical
              label "Include Nonmilestone Operations" no-undo.
define variable act-hrs              like op_act_run  no-undo.
define variable act-hrs-sub          like act-hrs     no-undo.
define variable act-hrs-tot          like act-hrs     no-undo.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
emp       colon 20      emp1      label {t001.i} colon 49
   part      colon 20      part1     label {t001.i} colon 49
   opdate    colon 20      opdate1   label {t001.i} colon 49
   wkctr     colon 20      wkctr1    label {t001.i} colon 49
   mch       colon 20      mch1      label {t001.i} colon 49
   shift     colon 20
   skip(1)
   include_nonmilestone        colon 35
    SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/* LIBRARY USED BY WEB ENABLED REPORTS */
{wbrp01.i}


/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   if wkctr1 = hi_char
   then
      wkctr1 = "".
   if mch1 = hi_char
   then
      mch1 = "".
   if opdate = low_date
   then
      opdate = ?.
   if opdate1 = hi_date
   then
      opdate1 = ?.
   if emp1 = hi_char
   then
      emp1 = "".
   if part1 = hi_char
   then
      part1 = "".

   if c-application-mode <> 'web'
   then
      
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   /* WEB ENABLEMENT */
   {wbrp06.i &command = update
             &fields  = "emp emp1 part part1 opdate
                         opdate1 wkctr wkctr1 mch mch1
                         shift include_nonmilestone"
             &frm     = "a"}

   if (c-application-mode <> 'web')
   or (c-application-mode = 'web'
   and (c-web-request begins 'data'))
   then do:

      bcdparm = "".
      /* BUILDS ONTO A STRING OF PARAMETER VALUES */
      {mfquoter.i emp    }
      {mfquoter.i emp1   }
      {mfquoter.i part   }
      {mfquoter.i part1  }
      {mfquoter.i opdate }
      {mfquoter.i opdate1}
      {mfquoter.i wkctr  }
      {mfquoter.i wkctr1 }
      {mfquoter.i mch    }
      {mfquoter.i mch1   }
      {mfquoter.i shift  }
      {mfquoter.i include_nonmilestone}

      if wkctr1 = ""
      then
         wkctr1 = hi_char.
      if mch1 = ""
      then
         mch1 = hi_char.
      if opdate = ?
      then
         opdate = low_date.
      if opdate1 = ?
      then
         opdate1 = hi_date.
      if emp1 = ""
      then
         emp1 = hi_char.
      if part1 = ""
      then
         part1 = hi_char.

   end. /* IF (C-APPLICATION-MODE <> 'WEB')... */

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:




   /* PRINT PAGE HEADINGS FOR REPORT */
   {mfphead.i}

   FORM /*GUI*/ 
      skip
      with STREAM-IO /*GUI*/  frame skip1 width 132 page-top.

   view frame skip1.
   if c-application-mode = 'web'
   then
      display
         with frame skip1 STREAM-IO /*GUI*/ .

   if shift > ""
   then do:

      FORM /*GUI*/  header
         getTermLabelRtColon("SHIFT",11) format "x(11)"
         shift
         with STREAM-IO /*GUI*/  frame shift width 132 no-attr-space page-top.
      view frame shift.
      if c-application-mode = 'web'
      then
         display
            with frame shift STREAM-IO /*GUI*/ .

   end. /* IF SHIFT > ""  */
   act-hrs-tot = 0.

   for each op_hist
      fields(op_act_run op_act_setup op_date op_emp op_mch op_milestone
             op_part op_qty_comp op_qty_rjct op_qty_rwrk op_qty_wip
             op_shift op_trnbr op_type op_wkctr op_wo_op op__dec01 )
      where (op_date  >= opdate   and    op_date  <= opdate1)
      and   (op_mch   >= mch      and    op_mch   <= mch1)
      and   (op_wkctr >= wkctr    and    op_wkctr <= wkctr1)
      and   (op_emp   >= emp      and    op_emp   <= emp1)
      and   (op_part  >= part     and    op_part  <= part1)
      and   (op_shift  = shift    or     shift     = "")
      and   (include_nonmilestone or     op_milestone)
      use-index op_date
      no-lock
      break by op_emp by op_date by op_part by op_wo_op
      by op_wkctr by op_mch by op_trnbr
      with frame f_op width 132 no-box:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame f_op:handle).

      if first-of(op_emp)
      then do:
         if page-size - line-counter < 4
         then
            page.
         display WITH STREAM-IO /*GUI*/ .

         /* FORMAT LABEL DYNAMICALLY */
         put {gplblfmt.i &FUNC=getTermLabel(""EMPLOYEE"",16)
                         &CONCAT="': '"} op_emp.
         for first emp_mstr
            fields(emp_addr emp_fname emp_lname)
            where emp_addr = op_emp
            no-lock:
         end. /* FOR FIRST emp_mstr */
         if available emp_mstr
         then
            put " " emp_fname + " " + emp_lname format "x(40)".

         act-hrs-sub = 0.
      end. /* IF FIRST-OF(op_emp) */

      if first-of(op_date)
      then do:
         if page-size - line-counter < 3
         then
            page.
         display WITH STREAM-IO /*GUI*/ .

         /* FORMAT LABEL DYNAMICALLY */
         put {gplblfmt.i &FUNC=getTermLabel(""DATE"",8)
                         &CONCAT="': '"} op_date skip.
      end. /* IF FIRST-OF(op_date)  */

      assign
         op_qty_scrap = op__dec01
         op_qty_move  = op_qty_wip.

      if op_type = "setup"
      then
         act-hrs = op_act_setup.
      else
         act-hrs = op_act_run.

      act-hrs-sub = act-hrs-sub + act-hrs.

      display
         op_part
         op_wo_op      format ">>>>9"
         op_wkctr
         op_mch
         op_qty_comp   column-label "Qty!Processed"
         op_qty_move   column-label "Qty!Moved"
         op_qty_rjct   column-label "Qty!Rejected"
         op_qty_scrap  column-label "Qty!Scrapped"
                       format "->>>>,>>9.9<<<<<<<"
         op_qty_rwrk   column-label "Qty!Reworked"
                       format "->>>>,>>9.9<<<<<<<"
         act-hrs       column-label "Act Hrs"
         op_type
         op_trnbr      format ">>>>>>>9" WITH STREAM-IO /*GUI*/ .

      accumulate op_qty_comp  (total by op_emp).
      accumulate op_qty_move  (total by op_emp).
      accumulate op_qty_rjct  (total by op_emp).
      accumulate op_qty_scrap (total by op_emp).
      accumulate op_qty_rwrk  (total by op_emp).
      accumulate op_act_run   (total by op_emp).
      accumulate op_act_setup (total by op_emp).

      if last-of (op_emp)
      then do:
         if page-size - line-counter < 2
         then
            page.

         underline
            op_qty_comp
            op_qty_move
            op_qty_rjct
            op_qty_scrap
            op_qty_rwrk
            act-hrs.

         down 1.

         display
            getTermLabel("TOTAL",10) + ":" @ op_part
            accum total by op_emp op_qty_comp @ op_qty_comp
            accum total by op_emp op_qty_move @ op_qty_move
            accum total by op_emp op_qty_rjct @ op_qty_rjct
            accum total by op_emp op_qty_scrap @ op_qty_scrap
            accum total by op_emp op_qty_rwrk @ op_qty_rwrk
            act-hrs-sub @ act-hrs WITH STREAM-IO /*GUI*/ .

         down 1.

         display
            getTermLabel("ACTUAL_RUN",9) + ":" @ op_part
            accum total by op_emp op_act_run @ act-hrs WITH STREAM-IO /*GUI*/ .
         down 1.

         display
            getTermLabel("ACTUAL_SETUP",11) + ":" @ op_part
            accum total by op_emp op_act_setup @ act-hrs WITH STREAM-IO /*GUI*/ .

         act-hrs-tot = act-hrs-tot + act-hrs-sub.

      end. /* IF LAST-OF (op_emp) */

      if last (op_emp)
      then do:
         if page-size - line-counter < 3
         then
            page.

         underline
            op_qty_comp
            op_qty_move
            op_qty_rjct
            op_qty_scrap
            op_qty_rwrk
            act-hrs.

         down 1.

         display
            getTermLabel("REPORT_TOTAL",16) + ":" @ op_part
            accum total op_qty_comp @ op_qty_comp
            accum total op_qty_move @ op_qty_move
            accum total op_qty_rjct @ op_qty_rjct
            accum total op_qty_scrap @ op_qty_scrap
            accum total op_qty_rwrk @ op_qty_rwrk
            act-hrs-tot @ act-hrs WITH STREAM-IO /*GUI*/ .

         down 1.

         display
            getTermLabel("ACTUAL_RUN",9) + ":" @ op_part
            accum total op_act_run @ act-hrs WITH STREAM-IO /*GUI*/ .
         down 1.

         display
            getTermLabel("ACTUAL_SETUP",11) + ":" @ op_part
            accum total op_act_setup @ act-hrs WITH STREAM-IO /*GUI*/ .

      end. /* IF LAST (op_emp) */

      /* END SECTION */
      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

   end. /* FOR EACH op_hist */

   hide frame shift.

   /* REPORT TRAILER */
   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

end. /* REPEAT */

/* WEB ENABLEMENT */
{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" emp emp1 part part1 opdate opdate1 wkctr wkctr1 mch mch1 shift include_nonmilestone "} /*Drive the Report*/
